      *> File Name     000022_Delegate.cbl.
      *> Description   Defining, instantiating, and invoking a delegate.
      *> Project Type  Console application.
      *> CodePlex URL  http://cobol.codeplex.com/
       
       program-id.   Main.
       repository.
           class sys-console as "System.Console"
           .
       working-storage section.
       01  d  type "D".
       01  c  type "C".
       procedure division.
           move "Define, Instantiate, and Invoke a Delegate"
               to sys-console::"Title"
           
           move type "C"::"New" to c
           move type "D"::"New"(c::"M") to d
           display d::"Invoke"
           
           display "Press any key to continue . . . " no advancing
           invoke sys-console::"ReadKey"(true)
           .
       end program   Main.
 
       delegate-id.  D.
       procedure division giving s as string.
       end delegate  D.
       
       class-id.     C.
       method-id.    M.
       procedure division giving s as string.
           move "Method M of class C has been invoked." to s
           .
       end method    M.
       end class     C.